package com.yinhai.redis.cluster.monitors;

import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.WatchedEvent;

public abstract class ChildrenMonitor extends AbstractMonitor{
	
	@Override
	public void process(WatchedEvent event) {
		try{
			doProcess(event);
		}finally{
			try {
				zk.getChildren(event.getPath(), this);
			} catch (KeeperException e) {
				e.printStackTrace();
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}

	protected abstract void doProcess(WatchedEvent event);

}
